package com.todoit.wavebot.util;

import java.util.List;

//import com.google.appengine.api.datastore.Key;
//import com.google.wave.api.Blip;
//ugly! we can't serialize otherwise!
//maybe there's a way to tell JDO otherwise
//but for now this will have to do.
import com.google.wave.api.impl.BlipImpl; 
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.jdo.annotations.*;

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable="true")
public class JdoUser {
	@PrimaryKey
	@Persistent
	private String userName;
	
    @Persistent
    private BlipImpl taskBlip;

    //@Persistent
    @Serialized
    @Element(types=com.todoit.wavebot.util.TodoitTask.class, dependent="true")
    private TodoitTaskList taskList;

    public JdoUser(String userName, BlipImpl taskBlip, TodoitTaskList taskList) {
        this.userName = userName;
        this.taskBlip = taskBlip;
        this.taskList = taskList;
    }

    public String getUserName() {
        return userName;
    } 
    public void setUserName(String userName) {
        this.userName = userName;
    } 

    public BlipImpl getTaskBlip() {
        return taskBlip;
    } 
    public void setTaskBlip(BlipImpl taskBlip) {
        this.taskBlip = taskBlip;
    } 

    public TodoitTaskList getTaskList() {
        return (TodoitTaskList) taskList;
    } 
    
    public void setTaskList(TodoitTaskList taskList) {
        this.taskList = taskList;
    }; 
    
	// registerUser(user) - adds a user with task target. (need to throw exception if failing?)
	// removeUser(user) - removes a user with task target
	// isUserRegistered(user) - checks if given user is known
	// getTaskList(user) - returns the task list for a given user
}
